/* 
 * This program is free software; you can redistribute it and/or modify 
 * it under the terms of the GNU General Public License as published by 
 * the Free Software Foundation; either version 3 of the License, or 
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful, but 
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 
 * for more details.
 * 
 * You should have received a copy of the GNU General Public License along 
 * with this program; if not, write to the Free Software Foundation, Inc., 
 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 */

#include "task.h"
#include "log.h"

namespace Wishmaster
{
	int Task::ms_currentId = 0;

	Task::Task(const QString& msg) : QObject(),
		m_message(msg),
		m_percentage(0)
	{
		m_id = ms_currentId++;
		//log(llDebug, "Task: %d", m_id);
	}

	Task::~Task()
	{
		//log(llDebug, "~Task: %d", m_id);
	}

	int Task::id()
	{
		return m_id;
	}

	void Task::setId(int i)
	{
		m_id = i;
	}

	QString Task::message() const
	{
		return m_message;
	}

	int Task::percentage()
	{
		return m_percentage;
	}

	void Task::setPercentage(int p)
	{
		m_percentage = p;
	}

	void Task::start()
	{
		emit started();
	}

	void Task::cancel()
	{
		emit cancelled();
	}

	void Task::onError()
	{
	}

	bool Task::isError() const
	{
		return false;
	}

	QString Task::errorMessage() const
	{
		return QString();
	}
}

